
from flask import Blueprint,request,render_template

dto_api = Blueprint("dto",__name__)
url_prefix = "/dto"
@dto_api.route("/index")
def index():

    return render_template('dto.html')


"""
sqlite 查询表名

SELECT * FROM sqlite_master
WHERE type='table'
ORDER BY name;


sqlite 查询表字段
PRAGMA table_info(base_connects)


pgsql 查询所有表

SELECT table_name 
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
  AND table_schema NOT IN ('pg_catalog', 'information_schema');

pgsql 查询表结构

SELECT
    a.column_name AS "name",
    udt_name AS "col_type",
    (CASE
        WHEN COALESCE(character_maximum_length, -999) = -999 THEN numeric_precision
        ELSE character_maximum_length
    END)||(CASE
        WHEN udt_name IN ('numeric', 'decimal') THEN ','||numeric_scale::text
        ELSE '' end) AS "len",
    
    CASE
        WHEN is_nullable = 'YES' THEN '1'
        ELSE ''
    END AS "nullable",
    CASE
        WHEN pk.constraint_name IS NOT NULL THEN '1'
        ELSE ''
    END AS "pk",
    column_default AS "defval",
		col_description(b.oid, a.ordinal_position) AS "desc"
FROM
    information_schema.columns AS a
LEFT JOIN
    pg_class AS b ON a.table_name = b.relname
LEFT JOIN
    information_schema.key_column_usage AS pk ON a.table_name = pk.table_name AND a.column_name = pk.column_name
LEFT JOIN
    information_schema.table_constraints AS tc ON pk.constraint_name = tc.constraint_name
WHERE
    a.table_name = 'app'
ORDER BY
    a.table_schema,
    a.table_name,
    a.ordinal_position;

mysql 查询所有表

SHOW TABLES;

mysql 查询表结构

SELECT  * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'wp_links'
"""
